package com.twetec.cms.common.constant;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;

public enum ColumnEnum {

    LIST("LIE_BIAO", "列表"),
    PAGE_LIST("FEN_YE_LIE_BIAO", "分页列表"),
    CHANNLE_COVER("PIN_DAO_FENG_MIAN", "频道封面"),
    JUMP_URL("TIAO_ZHUAN_LIAN_JIE", "跳转链接"),
    SITE_INDEX("ZHAN_DIAN_SHOU_YE", "站点首页");

    /**
     * 栏目类型
     */
    private String type;

    /**
     * 栏目类型名
     */
    private String name;

    private ColumnEnum(String type, String name) {
        this.type = type;
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "ColumnEnum{" +
                "type='" + type + '\'' +
                ", name='" + name + '\'' +
                '}';
    }

    /**
     * 获取集合List
     * @return
     */
    public static List<HashMap<String,String>> getColumnEnumList() {
        List<HashMap<String, String>> list = new ArrayList<>();

        for (ColumnEnum columnEnum : EnumSet.allOf(ColumnEnum.class)) {
            HashMap<String, String> map = new HashMap<>();
            map.put(columnEnum.type, columnEnum.name);
            list.add(map);
        }
        return list;
    }

    /**
     * 获取集合Map
     * @return
     */
    public static HashMap<String,String> getColumnEnumMap() {
        HashMap<String, String> map = new HashMap<>();
        for (ColumnEnum columnEnum : EnumSet.allOf(ColumnEnum.class)) {
            map.put(columnEnum.type, columnEnum.name);
        }
        return map;
    }
}
